cmd line tutorials - gencmd

cmd line tutorials - gencmd

The yes Command

Unix-Linux Mac

The yes command outputs a string repeatedly until stopped by the user or otherwise killed. It is a simple but powerful tool that can be used in a variety of ways, including:

  • Providing input to scripts and commands
  • Creating dummy files
  • Testing programs
  • Generating random data

Syntax

The basic syntax for the yes command is as follows:

yes [options] [string]

The [string] argument is the string that you want to output repeatedly. If you do not specify a string, the yes command will output y by default.

The [options] argument is a list of options that can be used to modify the behavior of the yes command.

Examples

Output the string “hello”.

yes hello

Create a dummy file named “myfile.txt” with many lines of “hello”.

yes hello | tee myfile.txt

With gencmd

output hello world to a file multiple times

  • yes hello world > output.txt",